<?php
namespace api\modules\v1\controllers;

use api\modules\v1\models\userFund\RechargeOrder;
use yii\filters\auth\HttpHeaderAuth;
use yii\helpers\ArrayHelper;

class RechargeController extends DefaultController
{
    public $modelClass = '';

    public function behaviors()
    {
        return ArrayHelper::merge(parent::behaviors(), [
            'authenticator' => [
                'class' => HttpHeaderAuth::className(),    //head头部验证
                'header' => 'access-token',
                'optional' => [                     //需要过滤掉不用token参数的方法
                ]
            ]
        ]);
    }
    /********************充值*************************/
    //兑换明细
    public function actionList($page = 1, $size = 10) {
        if (\Yii::$app->request->isGet) {
            return (new RechargeOrder())->getList($page, $size);
        }
    }

    //获取充值配置信息
    public function actionConfig()
    {
        if (\Yii::$app->request->isGet) {
            return (new RechargeOrder())->getConfig();
        }
    }

    public function actionRecharge()
    {
        if (\Yii::$app->request->isPost) {
            return (new RechargeOrder())->createOrder();
        }
    }
}
